{% extends 'GlpmrUserBundle::layout.html.twig' %}

{% block body %}
    <h1>Modifier un utilisateur</h1>
    <br /><br />

    {% if confirm is defined %}
        {% if confirm == "OK" %}
            <h3>Utilisateur modifi&eacute; avec succ&egrave;s</h3>
        {% else %}
            <h3>Erreur lors de la modif</h3>
        {% endif %}
    {% endif %}
    <div class="row">
        <form method="POST" action="{{ path('glpmr_user_modifier', {'id': user.id}) }}">
            <div class="col s6">
                <label for="username" class="inline form">Username : </label>
                <input id="username" type="text" value="{{ user.username }}" name="username"/>
            </div>
            <div class="col s6">
                <label for="mail" class="inline form">Email : </label>
                <input id="mail" type="email" value="{{ user.email }}" name="mail" />
            </div>
            <br />

            <div class="col s6">
                <label for="promotion" class="inline form">Promotion : </label>
                <select id="promotion" name="promotion" class="browser-default">
                    <option value="{{ user.promotion.libelle }}" selected>{{ user.promotion.libelle }}</option>
                    {% for promo in promotions %}
                        <option value="{{ promo.libelle }}">{{ promo.libelle }}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="col s6">
                <label for="role" class="inline form">Role : </label>
                <select id="role" name="role" class="browser-default">
                    <option value="{{ user.roles|first }}" selected>{{ user.roles|first }}</option>
                    <option value="ROLE_VISITEUR">ROLE_VISITEUR</option>
                    <option value="ROLE_ELEVE">ROLE_ELEVE</option>
                    <option value="ROLE_ADMIN">ROLE_ADMIN</option>
                </select>
            </div>

            <button type="submit" class="btn waves-effect waves-light margin-top-20">Envoyer</button>
        </form>
        <a href="{{ path('fos_user_resetting_request') }}"><button class="btn waves-effect waves-light">Reset mot de passe</button></a>
    </div>
{% endblock %}
